import 'package:flutter/material.dart';
/*页面切换动画*/
class MyAnimation {
  /*右边进入，右边退出*/
  static SlideTransition rightInOut(Animation<double> animation, Widget child) {
    return new SlideTransition(
      position: new Tween<Offset>(
        begin: const Offset(1.0, 0.0),
        end: const Offset(0.0, 0.0),
      ).animate(animation),
      child: child,
    );
  }

  /*左边进入，左边退出*/
  static SlideTransition leftInOut(Animation<double> animation, Widget child) {
    return new SlideTransition(
      position: new Tween<Offset>(
        begin: const Offset(-1.0, 0.0),
        end: const Offset(0.0, 0.0),
      ).animate(animation),
      child: child,
    );
  }
}